<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>键盘事件</title>
  <script src="../js/vue.js"></script>
</head>
<body>
<div id="root">
  姓：<input type="text" v-model="firstName"><br>
  名：<input type="text" v-model="lastName"><br>
  全名：<span>{{fullName}}</span>
</div>
<script>
  const vm = new Vue({
    el: "#root",
    data() {
      return {
        firstName: "张",
        lastName:"三",
      }
    },
    computed:{
      //计算属性简写方式，只有get()没有set()才能这么写
      fullName(){
         return this.firstName+'-'+this.lastName;
      }
    }
  });
</script>
</body>
</html>
